home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10955 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.8 KB

  1. Path: news.mindspring.com!usenet
  2. From: vtipres@atl.mindspring.com (shon frazier)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Permutation
  5. Date: Thu, 21 Mar 1996 04:29:10 GMT
  6. Organization: MindSpring Enterprises, Inc.
  7. Message-ID: <4iqlph$hib@B1FF.mindspring.com>
  8. References: <31503106.ABD@indi.aci.uni-heidelberg.de>
  9. Reply-To: vtipres@atl.mindspring.com
  10. NNTP-Posting-Host: user-168-121-120-68.dialup.mindspring.com
  11. X-Newsreader: Forte Free Agent 1.0.82
  12.  
  13. Stefan Reichling <steve@indi.aci.uni-heidelberg.de> wrote:
  14.  
  15. >Hi all,
  16.  
  17. >my problem is how to determine all possible permutations between two
  18. >numberd arrays.
  19.  
  20. >exmp: first array: 1 2 3 4
  21. >      second array: 1 2 3 4
  22.  
  23. >      first permut: 1 2 3 4
  24. >                    2 1 3 4
  25.  
  26. >      ect.
  27.  
  28. >I know that the maximum number of possible permutations is n!
  29. >How can I determine all possible array pairs ?
  30.  
  31. >thank's
  32.  
  33. >steve
  34. >-- 
  35. >+---------------------------------------------------------------------+
  36. >|  Stefan Reichling                                                   |
  37. >|                                     Anorganisch-Chemisches Instiut  |
  38. >|  Tel +49-6221-548565                   Universitaet Heidelberg      |
  39. >|  Fax +49-6221-545707                      69120 Heidelberg          |
  40. >|  e-mail: steve@indi.aci.uni-heidelberg.de      Germany              | 
  41. >|  www: http://ix.urz.uni-heidelberg.de/~il1                          |
  42. >+---------------------------------------------------------------------+
  43.  If I understand you correctly, then simply multiply the number of
  44. array elements in the first array by the number of array elements in
  45. the second array.
  46.  
  47. Therefore:   given  A has 4 elements (A[0],A[1],...) and B has 4
  48. elements (B[0],B[1],...) the total number of possible combinations is
  49. 4x4=16.  Also applies to multi-dimensioanl arrays.  If you have
  50. A[0][0] thru A[3][3] then there are a total of 16 elements.
  51.  
  52.